# -*- encoding: utf-8 -*-
"""

PyCharm 06axhline平行于x轴的水平吸纳
2024年10月27日11时50分
by wenyang

文件主要内容:


"""
import numpy as np
import matplotlib.pyplot as plt


def main():
    Fs = 100
    x = np.arange(1, 10, 1 / Fs)
    y = np.sin(x) + 1
    plt.xlim(1, 8)
    plt.ylim(-1, 2)
    plt.xlabel("Time(s)")
    plt.ylabel("Amplitude")
    plt.grid(ls = "--", color = "r")
    plt.axhline(y = 1, color = "g", ls = "--", lw = 2)  # 绘制水平参考线
    plt.axvline(x = 4.5, color = "b", ls = "--", lw = 2)  # 绘制垂直参考线
    plt.plot(x, y, ls = "-", lw = 3, color = "b")
    plt.show()


if __name__ == "__main__":
    main()
